<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>添加</title>

<style type="text/css">
<!--
.STYLE1 {font-size: 50px}
-->
</style>
</head>

<body>


<center>
<?php
error_reporting(E_ALL ^ E_DEPRECATED);
if(isset($_POST['button']))
{
    $name=$_POST['name'];
    $phone=$_POST['phone'];
    $position=$_POST['position'];
    $department=$_POST['department'];
    $plate=$_POST['plate'];
    $link = mysql_connect('localhost','root','xbsmpasswd') or die(mysql_error());// 建立连接
//var_dump($link);
    mysql_select_db('wechat',$link);// 选择数据库
    mysql_query('set names utf8');
    $sql="INSERT INTO wechat.mail_list (name,phone,position,department) values ('$name','$phone','$position','$department','$plate')";
    if(mysql_query($sql))
    {
        echo "<script>alert('添加成功！');</script>";
    }
    else
    {
         echo "<script>alert('添加失败！');</script>";
        
        }

}

?>
<form id="form1" name="form1" method="post" action="">
  <p class="STYLE1">添加</p>
  <table width="257" height="127" border="1">
    <tr>
      <td>姓名</td>
      <td><label>
        <input name="name" type="text" id="name">
      </label></td>
    </tr>
    <tr>
      <td>电话号码</td>
      <td><label>
        <input name="phone" type="text" id="phone">
      </label></td>
    </tr>
    <tr>
      <td>职位</td>
      <td><label>
        <input name="position" type="text" id="position">
      </label></td>
    </tr>
      <tr>
          <td>部门</td>
          <td><label>
                  <input name="department" type="text" id="department">
              </label></td>
      </tr>
      <tr>
          <td>板块</td>
          <td><label>
                  <input name="plate" type="text" id="plate">
              </label></td>
      </tr>
  </table>
  <p>&nbsp;</p>
  <tr>
<td colspan="2" align="center"><input type="submit" name="button" value="提交" />
<input type="button" name="button2" value="返回" onclick="location.href='mail_list.php'" />
</td>
</tr>
<p>&nbsp;</p>
</form>
</center>
</body>
</html>